package com.example.company.service.impl;


import com.example.company.entity.Attendance;
import com.example.company.entity.Users;
import com.example.company.mapper.AttendanceMapper;
import com.example.company.service.IAttendanceService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 存储员工考勤记录Service业务层处理
 *
 * @author ruoyi
 * @date 2024-12-30
 */
@Service
public class AttendanceServiceImpl implements IAttendanceService {
	@Autowired
	private AttendanceMapper attendanceMapper;
	
	/**
	 * 查询存储员工考勤记录
	 *
	 * @param AttendanceID 存储员工考勤记录主键
	 * @return 存储员工考勤记录
	 */
	@Override
	public Attendance selectAttendanceByAttendanceID(Long AttendanceID) {
		return attendanceMapper.selectAttendanceByAttendanceID(AttendanceID);
	}
	
	/**
	 * 查询存储员工考勤记录列表
	 *
	 * @param attendance 存储员工考勤记录
	 * @return 存储员工考勤记录
	 */
	@Override
	public List<Attendance> selectAttendanceList(Attendance attendance) {
		return attendanceMapper.selectAttendanceList(attendance);
	}
	
	/**
	 * 新增存储员工考勤记录
	 *
	 * @param attendance 存储员工考勤记录
	 * @return 结果
	 */
//	@Override
//	public int insertAttendance(Attendance attendance) {
//		return attendanceMapper.insertAttendance(attendance);
//	}
//
	/**
	 * 修改存储员工考勤记录
	 *
	 * @param attendance 存储员工考勤记录
	 * @return 结果
	 */
	@Override
	public int updateAttendance(Attendance attendance) {
		return attendanceMapper.updateAttendance(attendance);
	}
	
	/**
	 * 批量删除存储员工考勤记录
	 *
	 * @param AttendanceIDs 需要删除的存储员工考勤记录主键
	 * @return 结果
	 */
	@Override
	public int deleteAttendanceByAttendanceIDs(Long[] AttendanceIDs) {
		return attendanceMapper.deleteAttendanceByAttendanceIDs(AttendanceIDs);
	}
	
	/**
	 * 删除存储员工考勤记录信息
	 *
	 * @param AttendanceID 存储员工考勤记录主键
	 * @return 结果
	 */
	@Override
	public int deleteAttendanceByAttendanceID(Long AttendanceID) {
		return attendanceMapper.deleteAttendanceByAttendanceID(AttendanceID);
	}
	
	@Override
	public PageInfo<Attendance> findPage2(Integer pageNum, Integer pageSize, Attendance attendance) {
		PageHelper.startPage(pageNum,pageSize);
		List<Attendance>list=attendanceMapper.selectAttendanceList(attendance);
		PageInfo<Attendance>info=new PageInfo<>(list);
		
		
		
		return info;
	}
}
